package lesson3.slides.io;

import java.io.*;

public class StringReaderExample {

    public static void main(String[] args) throws IOException {
        String s =
                "This is the string source to be used for input.";
        StringReader in = new StringReader(s);
        FileWriter out = new FileWriter("filesink2.txt2");
        int c;
        int count = 0;
        while ((c = in.read()) != -1) {
            count++;
            out.write(c);
        }
        
        in.close();
        out.close();
        System.out.println("Copied " + count + " bytes");
    }
}
